package api

import (
	"github.com/gin-gonic/gin"
	"shop/api/handler"
	"shop/pkg"
)

func Router(c *gin.Engine) {
	api := c.Group("/api")
	{
		user := api.Group("/user")
		{
			user.POST("/register", handler.Register)

			user.POST("/login", handler.Login)

		}
		shop := api.Group("/shop")
		{
			shop.POST("/add", handler.AddShop)

			shop.POST("/queryId", handler.QueryOneShop)

			shop.POST("/update", handler.UpdateShop)

			shop.POST("/delete", handler.DeleteShop)

		}

		comment := api.Group("/comment")
		{
			shop.POST("/queryShopCommentByShopId", handler.QueryShopCommentByShopId)

			comment.Use(pkg.JWTAuth("2212a"))

			comment.POST("/add", handler.AddShopComment)

			comment.POST("/update", handler.UpdateShopComment)

			comment.POST("/delete", handler.DeleteShopComment)

		}

	}
}
